<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:kevin@archlinux.org" />
</head>

<body style="background-color: white">



<ul id="index">
  <li><a href="#SVM">SVM</a></li>
  <li><a href="#USAGE">USAGE</a></li>
  <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="#BUILDING-THE-EXECUTABLE">BUILDING THE EXECUTABLE</a></li>
  <li><a href="#CALLING-THE-SVM-SOLVER-WITH-ASCII-DATA">CALLING THE SVM SOLVER WITH ASCII DATA</a></li>
  <li><a href="#OPTIONS">OPTIONS</a></li>
  <li><a href="#SAMPLE-INPUT-FILE">SAMPLE INPUT FILE</a></li>
  <li><a href="#MATLAB-INTERFACE">MATLAB INTERFACE</a></li>
  <li><a href="#FIN">FIN</a></li>
</ul>

<h1 id="SVM">SVM</h1>

<p>SVM - A module for creating linear support vector machine classifiers.</p>




This page is part of the <A HREF=../index.html> OOQP documentation </A>.

<h1 id="USAGE">USAGE</h1>

<p>To read the data from a file:</p>

<p><b>svm-gondzio.exe</b> [ <b>--quiet</b> ] [ <b>--print-solution</b> ] filename [ penalty ]</p>

<p>To generate a random problem for benchmarking:</p>

<p><b>svm-gondzio.exe</b> [ <b>--quiet</b> ] [ <b>--print-solution</b> ] <code>random</code> hdim nobs</p>

<p>where &quot;<code>random</code>&quot; is a literal keyword.</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<p>Linear support vector machine problems take two sets of points in n-space and attempt to find a hyperplane which separates them. If no such plane exists, it looks for a plane for which the misclassification errors are minimized, while satisfying some regularity condition. For additional details, we refer to Section 6.2 of the paper &quot;Object-Oriented Software for Quadratic Programming&quot; that is included in this distribution, and to Chapter 5 of V. Vapnik: <i>The Nature of Statistical Learning Theory</i>, 2nd edition, Springer, 1999.</p>

<p>The SVM module of OOQP accepts as input a collection of points in n-space, a label for each point (the label taking on one of two distinct values indicating the set to which the point belongs) and the value of the penalty parameter, which is the weight on the term in the objective function indicating violation of the constraints. The output is an n-vector <code>w</code> and a scalar <code>beta</code> that define the hyperplane. If the two sets are separable and the penalty parameter is sufficiently large, then <code>(w,beta)</code> defines a separating hyperplane.</p>

<h1 id="BUILDING-THE-EXECUTABLE">BUILDING THE EXECUTABLE</h1>

<p>An implementation of the SVM solver that uses Gondzio&#39;s algorithm and reads data from an ascii file is supplied with the OOQP distribution. To generate this executable, first follow the installation procedures described in the file <a href="../distribution-docs/INSTALL.html">INSTALL</a>. Then, from the main OOQP directory, type</p>

<pre><code>    make svm-gondzio.exe</code></pre>

<h1 id="CALLING-THE-SVM-SOLVER-WITH-ASCII-DATA">CALLING THE SVM SOLVER WITH ASCII DATA</h1>

<p>The input file for the SVM module should contain the dimensions of the problem followed by the points in the problem and their labels. The format is as follows:</p>

<pre><code>       l
       n
       x1(1) x1(2) ... x1(n) label_1
       x2(1) x2(2) ... x2(n) label_2
       ...
       xl(1) xl(2) ... xl(n) label_l</code></pre>

<p>where l is an integer representing the number of observations (must be at least 2); n is the dimension of the space in which all the data points reside (must be at least 1); <code>(xi(1) xi(2) ... xi(n))</code> represent the n coordinates of the i-th point, and label_i is a real number which takes on one of two distinct values, indicating the set to which point i belongs.</p>

<p>The most common mode for invoking the executable is the following</p>

<pre><code>        svm-gondzio.exe filename penalty</code></pre>

<p>where &quot;filename&quot; is the name of the ascii file containing the data and &quot;penalty&quot; is the positive real value defining the penalty parameter. One can also use the format:</p>

<pre><code>        svm-gondzio.exe filename </code></pre>

<p>which sets the penalty parameter to a default value of 1.0. Output from the solver will be written to <i>filename.out</i> where the string &quot;filename&quot; will be replaced by the actual name of the input file. The output format is</p>

<pre><code>       n
       w_1
       ...
       w_n
       beta</code></pre>

<p>Where n, w and beta are as described above. If label_1 and label_2 have opposite signs, then data with</p>

<pre><code>      w&#39; * x - beta &gt;= 0</code></pre>

<p>is classifed as belonging to the set represented by the positive label. Otherwise, the first label to be found will be taken to represent the positive side of the hyperplane.</p>

<p>Finally, to benchmark the efficiency of the solver for certain problem dimensions, one can type</p>

<pre><code>        svm-gondzio.exe random n l</code></pre>

<p>where &quot;random&quot; is a literal keyword, and n and l are the problem dimensions as defined above.</p>

<h1 id="OPTIONS">OPTIONS</h1>

<dl>

<dt id="quiet">--quiet</dt>
<dd>

<p>Do not print progress information while the problem is being solved and do not print the solution to the screen.</p>

</dd>
<dt id="print-solution">--print-solution</dt>
<dd>

<p>Print the solution to the screen when the algorithm is finished. Overrides the <b>--quiet</b> option.</p>

<p>The solution is printed by default if it is small (<code>hdim</code> &lt; 20) and the <b>--quiet</b> option is not in effect.</p>

</dd>
</dl>

<h1 id="SAMPLE-INPUT-FILE">SAMPLE INPUT FILE</h1>

<p>We have supplied a real data set with the OOQP distribution which can be used to test the SVM solver. This set, in file <i>OOQP/examples/Svm/svm.wisconsin.data</i>, contains breast cancer data from a Wisconsin study. There are 679 observations of points from nine-dimensional space. To execute the program with this test data, make the svm-gondzio.exe file as described above, go to the OOQP directory, and type</p>

<pre><code>    svm-gondzio.exe ./examples/Svm/svm.wisconsin.data  penalty</code></pre>

<p>where &quot;penalty&quot; is the chosen value of the penalty parameter. Suitable values for &quot;penalty&quot; for this data set include 1.0 and 10.0.</p>

<h1 id="MATLAB-INTERFACE">MATLAB INTERFACE</h1>

<p>The SVM code may be invoked from Matlab. Documentation for this interface may be read within Matlab. See the <a href="../distribution-docs/README_Matlab.html">README_Matlab</a> file for instruction on how to install the Matlab interface. One the interface is installed, type</p>

<pre><code>        help ooqp_svm</code></pre>

<p>at the Matlab prompt.</p>

<h1 id="FIN">FIN</h1>




Back to the <A HREF=../index.html> Documentation Roadmap </A>.


</body>

</html>


